﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using BEGDC.CC.Web.UserControls;
using BEGDC.Utility.Castle;
using BEGDC.CC.BL.Common;
using BEGDC.CC.BL.CCFlow.CR;

namespace BEGDC.CC.Web.UserControls.CR
{
	/// <summary>
	/// Summary description for CommonComment.
	/// </summary>
	public class PrintForm : System.Web.UI.Page
	{
		//protected BEGDC.CC.Web.UserControls.CR.EZCtrl EZCtrl;
        protected BEGDC.CC.Web.UserControls.CR.NormalCtrl NormalCtrl;

		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!this.IsPostBack)
			{
				//base.PreInitForm();
                int appid;
                Int32.TryParse(Request["AppID"] ,out appid);
                long flowId = 0;
                if (appid > 0)
                {
                    BEGDC.CC.Entity.Application app = null;
                    ICR CRService = AppContainer.Instance[ServiceConst.CRService] as ICR;
                    app = CRService.GetApplication(appid);

                    if (app != null)
                    {
                        BEGDC.CC.Entity.FlowInstance flow = CRService.GetApplicationFlow(appid);
                        if (flow != null)
                        {
                            flowId = flow.FlowID;
                        }
                        //BindFlowInfo( project.Id, project.NBPMFlow );
                    }
                    else
                    {
                        WebUtility.Go2ErrorPage(this.Page, "Application not found!");
                        //return flowId;
                    }
                    this.NormalCtrl.App = app;
                }
				InitForm();
			}
		}

		#region InitForm
		private void InitForm()
		{
			bool isReadOnly = true;
			//long flowId  = this.LoadApplication();

			//EZCtrl.Visible = true;
			//EZCtrl.isReadOnly = isReadOnly;
            NormalCtrl.Visible = true;
            NormalCtrl.isReadOnly = true;
		}
		#endregion

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}
